<template>
    <div class="box">
        <Alert>
            <Form :model="searchObj" inline>
                <FormItem>
                    <Input v-model="searchObj.name" class="search-input" clearable placeholder="请输入姓名"/>
                </FormItem>
                <FormItem>
                    <Input v-model="searchObj.id_card" class="search-input" clearable placeholder="请输入身份证号"/>
                </FormItem>
                <FormItem>
                    <Button class="search-btn" type="primary" @click="searchAction">
                        <Icon type="ios-search"/>
                        比对公安库
                    </Button>
                </FormItem>
                <FormItem>
                    <Button class="search-btn" type="primary" @click="searchCommission">
                        <Icon type="ios-search"/>
                        比对卫健库
                    </Button>
                </FormItem>
                <FormItem>
                    <Button class="search-btn" type="primary" @click="searchDie">
                        <Icon type="ios-search"/>
                        查询沈阳殡葬
                    </Button>
                </FormItem>
            </Form>
        </Alert>
        <Row :gutter="30">
            <Col span="8"><Card style="width: 325px" v-if="gongan">
                <div style="text-align:center">
                    <h3>{{FHMS}}</h3>
                    <h3>性别：{{XBDM}}</h3>
                    <h3>民族：{{MZDM}}</h3>
                    <h3>出生日期：{{CSRQ}}</h3>
                    <h3>出生地_国家：{{CSD_GJHDQDM}}</h3>
                    <h3>出生地_省市县：{{CSD_SSXQDM}}</h3>
                    <h3 v-if="this.SWBS ==0">死亡标识：有效人口</h3>
                    <h3 v-if="this.SWBS ==1">死亡标识：死亡人口</h3>
                    <h3 v-if="this.GMSFHM_PPDDM == 1">
                        公民身份号码匹配度：一致
                    </h3>
                    <h3 v-if="this.GMSFHM_PPDDM == 2">
                        公民身份号码匹配度：完全匹配
                    </h3>
                    <h3 v-if="this.GMSFHM_PPDDM == 3">
                        公民身份号码匹配度：相似匹配
                    </h3>
                    <h3 v-if="this.GMSFHM_PPDDM == 4">
                        公民身份号码匹配度：未匹配
                    </h3>
                    <h3 v-if="this.XM_PPDDM == 1">
                        姓名匹配度：一致
                    </h3>
                    <h3 v-if="this.XM_PPDDM == 2">
                        姓名匹配度：完全匹配
                    </h3>
                    <h3 v-if="this.XM_PPDDM == 3">
                        姓名匹配度：相似匹配
                    </h3>
                    <h3 v-if="this.XM_PPDDM == 4">
                        姓名匹配度：未匹配
                    </h3>
                </div>
            </Card></Col>
            <Col span="8"><Card style="width: 325px" v-if="weijian">
                <div style="text-align:center">
                </div>
            </Card></Col>
            <Col span="8"><Card style="width: 325px" v-if="binzang">
                <div style="text-align:center">
                    <h3 v-if="this.flag == 'true'">已死亡</h3>
                    <h3 v-if="this.flag == 'false'">未死亡</h3>
                    <h3 v-if="this.flag == 'true'">死亡时间：{{cremationTime}}</h3>
                </div>
            </Card></Col>
        </Row>
    </div>
</template>

<script>
import {
  selectGongAnInfo, binZhang
} from '@/api/pass'

export default {
  components: {},
  data () {
    return {
      gongan: false,
      binzang: false,
      weijian: false,
      flag: null,
      cremationTime: null,
      XBDM: null, // 性别
      MZDM: null, // 民族
      CSRQ: null, // 出生日期
      CSD_GJHDQDM: null, // 出生地_国家（地区）
      CSD_SSXQDM: null, // 出生地_省市县（区）
      SWBS: null, // 死亡标识（0.有效人口，1.死亡人口）
      FHMS: null,
      GMSFHM_PPDDM: null,
      XM_PPDDM: null,
      searchObj: {}
    }
  },
  methods: {
    searchAction () {
      this.gongan = true
      let data = {
        id_card: this.$common.xeUtils.trim(this.searchObj.id_card),
        name: this.$common.xeUtils.trim(this.searchObj.name)
      }
      selectGongAnInfo(data).then(ret => {
        console.log(ret, '我是谁')
        if (ret.data.errcode === 200) {
          this.FHMS = ret.data.data.PACKAGEHEAD.FHMS
          this.GMSFHM_PPDDM = ret.data.data.DATA.RECORD.GMSFHM_PPDDM
          this.XM_PPDDM = ret.data.data.DATA.RECORD.XM_PPDDM
          this.XBDM = ret.data.data.DATA.RECORD.XBDM
          this.MZDM = ret.data.data.DATA.RECORD.MZDM
          this.CSRQ = ret.data.data.DATA.RECORD.CSRQ
          this.CSD_GJHDQDM = ret.data.data.DATA.RECORD.CSD_GJHDQDM
          this.CSD_SSXQDM = ret.data.data.DATA.RECORD.CSD_SSXQDM
          this.SWBS = ret.data.data.DATA.RECORD.SWBS
        } else {
          this.$Message('22222')
        }
      })
    },
    searchCommission () {
      this.weijian = true
    },
    searchDie () {
      this.binzang = true
      let data = {
        id_card: this.$common.xeUtils.trim(this.searchObj.id_card)
      }
      binZhang(data).then(ret => {
        if (ret.data.errcode === 200) {
          this.flag = ret.data.data.flag
          this.cremationTime = ret.data.data.cremationTime
        }
      })
    }
  },
  mounted () {
  }
}
</script>

<style scoped>
    .ivu-form-item {
        margin-bottom: 0;
    }

    .box {
        margin-bottom: 50px;
    }
</style>
